{% extends 'myadmin/index.html' %}

{% block title %}
<title>后台管理列表</title>
{% endblock%}

{% block con %}
<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title  am-cf">管理员列表</div>

                </div>
                <div class="widget-body  am-fr">

                    <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
                        <div class="am-form-group">
                            <div class="am-btn-toolbar">
                                <div class="am-btn-group am-btn-group-xs">
                                    <a href="{% url "authuser_add" %}" class="am-btn am-btn-default am-btn-success"><span class="am-icon-plus"></span> 新增</a>
                                </div>
                            </div>
                        </div>
                    </div>



                    <div class="am-u-sm-12">
                        <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black ">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>用户名</th>
                                    <th>邮箱</th>
                                    <th>超级用户</th>
                                    <th>所在组</th>
                                    <th>添加时间</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                            {% for v in userdata %}
                            <tr>
                                <td class="am-text-middle">{{v.id}}</td>
                                 <td class="am-text-middle">{{v.username}}</td>
                                 <td class="am-text-middle">{{v.email}}</td>
                                 <td class="am-text-middle">
                                 {% if v.is_superuser %}
                                     <span style="color:#d93c37;">超级管理员</span>
                                  {% else %}
                                     <span style="color:#3bb4f2;">普通管理员</span>
                                  {% endif %}

                                 </td>
                                <!--用户组 对象 使用join 处理成字符串-->
                                 <td class="am-text-middle">{{v.groups.all|join:','}}</td>
                                <td class="am-text-middle">{{ v.date_joined }}</td>
                                 <td class="am-text-middle">
                                        <div class="tpl-table-black-operation">
                                            <a href="{% url 'authuser_edit' %}?id={{v.id}}">
                                                <i class="am-icon-pencil"></i> 编辑
                                            </a>
                                             <a href="{% url 'authuser_del' %}?id={{ v.id }}" class="tpl-table-black-operation-del">
                                                <i class="am-icon-trash"></i> 删除
                                             </a>
                                        </div>
                                    </td>
                            </tr>
                            {% endfor %}
                                     <!-- more data -->
                            </tbody>
                        </table>
                    </div>
                    <div class="am-u-lg-12 am-cf">

                        <div class="am-fr">
                            <ul class="am-pagination tpl-pagination">

                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}